<template>
  <div>
    <el-form-item label="是否显示头像" prop="userCenter.sfdsrw">
      <el-radio-group v-model="form.userCenter.isShowImage" style="width: 180px">
        <el-radio
          v-for="item in this.dict.whether_type"
          :key="item.id"
          :label="item.value"
        >{{ item.label }}
        </el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="是否显示名称" prop="userCenter.isShowName">
      <el-radio-group v-model="form.userCenter.isShowName" style="width: 180px">
        <el-radio
          v-for="item in this.dict.whether_type"
          :key="item.id"
          :label="item.value"
        >{{ item.label }}
        </el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="是否显示电话" prop="userCenter.isShowPhone">
      <el-radio-group v-model="form.userCenter.isShowPhone" style="width: 180px">
        <el-radio
          v-for="item in this.dict.whether_type"
          :key="item.id"
          :label="item.value"
        >{{ item.label }}
        </el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="是否显示邮箱" prop="userCenter.isShowEmail">
      <el-radio-group v-model="form.userCenter.isShowEmail" style="width: 180px">
        <el-radio
          v-for="item in this.dict.whether_type"
          :key="item.id"
          :label="item.value"
        >{{ item.label }}
        </el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="是否显示部门" prop="userCenter.isShowDepart">
      <el-radio-group v-model="form.userCenter.isShowDepart" style="width: 180px">
        <el-radio
          v-for="item in this.dict.whether_type"
          :key="item.id"
          :label="item.value"
        >{{ item.label }}
        </el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="是否显示院系" prop="userCenter.isShowYx">
      <el-radio-group v-model="form.userCenter.isShowYx" style="width: 180px">
        <el-radio
          v-for="item in this.dict.whether_type"
          :key="item.id"
          :label="item.value"
        >{{ item.label }}
        </el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="是否显示班级" prop="userCenter.isShowBj">
      <el-radio-group v-model="form.userCenter.isShowBj" style="width: 180px">
        <el-radio
          v-for="item in this.dict.whether_type"
          :key="item.id"
          :label="item.value"
        >{{ item.label }}
        </el-radio>
      </el-radio-group>
    </el-form-item>
  </div>
</template>

<script>
import userCenter from '@/api/system/userCenter'

export default {
  name: 'UserCenter',
  props: {
    form: {
      type: Object,
      require: true
    }
  },
  data() {
    return {
      rules: {
        columnName: [
          { required: true, message: '请输入栏目名称', trigger: 'blur' }
        ],
        icon: [
          { required: true, message: '栏目图标不能为空', trigger: 'blur' }
        ]
      }
    }
  },
  mounted() {
    this.$emit('getRules', this.rules)
    const id = this.form.id
    if (id != null) {
      userCenter.queryEntity(id).then(res => {
        this.form.userCenter = res
        this.form.userCenter.isShowImage = this.form.userCenter.isShowImage.toString()
        this.form.userCenter.isShowName = this.form.userCenter.isShowName.toString()
        this.form.userCenter.isShowPhone = this.form.userCenter.isShowPhone.toString()
        this.form.userCenter.isShowEmail = this.form.userCenter.isShowEmail.toString()
        this.form.userCenter.isShowDepart = this.form.userCenter.isShowDepart.toString()
        this.form.userCenter.isShowYx = this.form.userCenter.isShowYx.toString()
        this.form.userCenter.isShowBj = this.form.userCenter.isShowBj.toString()
      }).catch(error => {
        console.log(error)
      })
    }
  },
  dicts: ['whether_type']
}
</script>

<style scoped>

</style>
